using System;
using System.Collections.Generic;
using System.Text;

namespace OpenComposite.EII.Simulation
{
	public class ReportData
	{
		public ReportData()
		{
			_actname = "";
			_kpiname = "";
			_value = 0m;
		}
		public ReportData(string actname, string kpiname, decimal value)
		{
			_actname = actname;
			_kpiname = kpiname;
			_value = value;
		}

		private string _actname;
		public string ActivityName
		{
			get { return _actname; }
			set { _actname = value; }
		}
		private string _kpiname;
		public string KPIName
		{
			get { return _kpiname; }
			set { _kpiname = value; }
		}

		private decimal _value;
		public decimal Value
		{
			get { return _value; }
			set { _value = value; }
		}
	}

	public class ReportDataList
	{
		public ReportDataList()
		{
			_data = new List<ReportData>();
		}

		private List<ReportData> _data;
		public List<ReportData> Data
		{
			get { return _data; }
		}

		public void Add(string actname, string kpiname, decimal value)
		{
			_data.Add(new ReportData(actname, kpiname, value));
		}
		public void Add(string actname, string kpiname, object value)
		{
			decimal d = 0;
			try {
				if ( value is int || value is long || value is decimal || value is double || value is float )
					d = Convert.ToDecimal(value);
				else {
					decimal.TryParse(value.ToString(), out d);
				}
			} catch {
			}
			_data.Add(new ReportData(actname, kpiname, d));
		}
	}
}
